/*
 * Copyright 2000-2020 ALPHA LAB.Inc All Rights Reserved.
 */
package com.alphalab.framework.test.queryTest;
 
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; 
import org.springframework.web.bind.annotation.RequestMapping; 
import com.alphalab.framework.context.GeneralQueryContext; 
/**
 * ProjectItemQueryContext.
 * @author allen 
 * @version 1.0.0 2017年12月25日
 */
@Controller 
@RequestMapping("/projectItemQueryContext")
public class ProjectItemQueryContext extends 
	GeneralQueryContext<ProjectItemVo, IProjectItemQueryRole> implements IProjectItemQueryContext {

	/**
	 * 手动注入projectItemQueryRole.
	 * @param projectItemQueryRole projectItemQueryRole
	 */
	@Autowired
	public void setProjectItemQueryRole(IProjectItemQueryRole projectItemQueryRole) { 
		super.setGeneralQueryRole(projectItemQueryRole);
	}

	/**
	 * 获取项目额外信息.
	 * @param projectId projectId
	 * @return List<Map>
	 */ 
	public List<Map> getProjectItemExtendList(final String projectId) { 
		return getGeneralQueryRole().getProjectItemExtendList(projectId);
	}

	/**
	 * 获取项目信息.
	 * @param projectId projectId
	 * @param description description
	 * @param userName userName
	 * @return List<ProjectItemDetailVo>
	 */ 
	public List<ProjectItemDetailVo> getProjectItemDetailList(final String projectId,
			final String description, final String userName) { 
		return getGeneralQueryRole().getProjectItemDetailList(projectId, description, userName);
	}

	/**
	 * 获取项目信息.
	 * @param queryParamVo queryParamVo 
	 * @return List<ProjectItemDetailVo>
	 */ 
	public List<ProjectAnalysisVo> getProjectItemDetailList(final QueryParamVo queryParamVo) { 
		List<ProjectItemVo> projectItemVos = getGeneralQueryRole().findListWithCondition(null, null, null);
		List<ProjectAnalysisVo> projectAnalysisVos = new ArrayList<ProjectAnalysisVo>();
		for (ProjectItemVo projectItemVo : projectItemVos) {
			ProjectAnalysisVo projectAnalysisVo = new ProjectAnalysisVo();
			projectAnalysisVo.setName(projectItemVo.getName());
			projectAnalysisVo.set("createUserName", "10086");	
			projectAnalysisVos.add(projectAnalysisVo);
		} 
		return projectAnalysisVos;
	} 
	
}
